<?php
class Payment_Model_DbTable_Metadata extends YouNet_Db_Table
{
	const TABLE_NAME = 'ym_metadata';
	const PRICE_TABLE = 'price_table';
	
	protected $_name = self::TABLE_NAME;
	protected $_rowClass = 'Payment_Model_Metadata';
	private static $_instance;

	/**
	 * @return Payment_Model_DbTable_Metadata
	 */
	public static function getInstance()
	{
		if (is_null(self::$_instance))
		{
			self::$_instance = new self();
		}
		return self::$_instance;
	}
	
	public function findByName($name)
	{
		return $this->findOne($name);
	}
	
	public function getDecodedValue($name)
	{
		$metadata = $this->findOne($name);
		if (!empty($metadata))
		{
			return json_decode($metadata->value);
		}
		return null;
	}
}

